<template>
	<view class="invest-money" :style="[{paddingTop:statusBar+ 'px'}]">
		<view class="status" :style="[{height:statusBar+ 'px'}]" ></view>
		<view class="navigation" :style="[{top:(statusBar-2)+ 'px'}]">
			<image src="/static/images/back.png" class="back" @click="back()" mode=""></image>
			<view class="navigation-title">账户储值</view>
		</view>
		<view class="navigation-position"></view>		
		
		<view class="choice-charge-num-box">
			<view class="choice-charge-num-title">请选择储值金额</view>
				<view class="choice-charge-num-list">
					<view class="choice-charge-num-item" v-for="(item,index) in chargeNumList" :key="index" :class="[index==tabIndex?'activeTab':'']" @click="tabMth(index,item)">
						<text>{{ item }}</text>
						<text>元</text>
					</view>
			</view>
		</view>
		<!-- <view class="invest-money-tips"><text>特别提示：</text> 严禁利用提现免手续费套现信用卡，一经发现立即永久封号处理！</view> -->
		
		<view class="withdrawal-methods">
			<view class="withdrawal-methods-title">请选择储值方式</view>
			<view class="choice-item" @click="choiceMethods('alipay')">
				<view class="choice-item-left">
					<image src="/static/images/ali.png" class="wechat-methods" mode=""></image>
					<view>支付宝</view>
				</view>
				<view class="choice-radio">
					<image src="/static/images/choicedicon.png" class="choiced" v-if="choiceType=='alipay'" mode=""></image>
					<view v-else></view>
				</view>
			</view>
			
			<!-- <view class="choice-item-line"></view>
			<view class="choice-item" @click="choiceMethods('wxpay')">
				<view class="choice-item-left">
					<image src="/static/images/weixinpay.png" class="wechat-methods" mode=""></image>
					<view>微信</view>
				</view>
				<view class="choice-radio">
					<image src="/static/images/choicedicon.png" class="choiced" v-if="choiceType=='wxpay'" mode=""></image>
					<view v-else></view>
				</view>
			</view>
			-->
			<view class="choice-item-line"></view>
			<view class="choice-item" @click="choiceMethods('unionpay')">
				<view class="choice-item-left">
					<image src="/static/images/bank-default-icon.png" class="wechat-methods" mode=""></image>
					<view>银行卡</view>
				</view>
				<view class="choice-radio">
					<image src="/static/images/choicedicon.png" class="choiced" v-if="choiceType=='unionpay'" mode=""></image>
					<view v-else></view>
				</view>
			</view>
		</view> 
		
		<!-- 如微信无法储值， -->
		<!-- <view class="charge-tips-box">
			<view class="charge-tips-title">如支付宝无法储值，请使用转账汇款的方式进行储值，储值后约1~10小时到账。</view>
			<view class="charge-tips-item">
				<view class="charge-tips-text-box">
					<text>账户名称：</text>
					<text>北京一加二购科技有限公司</text>
				</view>
				<view class="copy-btn" @click="copy('北京一加二购科技有限公司')">
					<view>| 复制</view>
				</view>
			</view>
			<view class="charge-tips-item">
				<view class="charge-tips-text-box">
					<text>账户号码：</text>
					<text>15624959040025</text>
				</view>
				<view class="copy-btn" @click="copy('15624959040025')">
					<view>| 复制</view>
				</view>
			</view>
			<view class="charge-tips-item">
				<view class="charge-tips-text-box">
					<text>开户银行：</text>
					<text>平安银行北京光华路支行</text>
				</view>
				<view class="copy-btn" @click="copy('平安银行北京光华路支行')">
					<view>| 复制</view>
				</view>
			</view>
			<view class="charge-tips-item">
				<view class="charge-tips-text-remarks">
					<text>附言（备注）：</text>
					<text class="charge-tips-item-text">服务费+储值人的邀请码  举例：服务费+123456780</text>
				</view>
				
			</view>
			<view class="charge-tips-important">
				注：为了保障您的权益，请务必填写正确的附言（备注）信息。
			</view>
		</view> -->
		
		<view class="invest-money-btn" @click="investMoney()">确认储值</view>
		<uni-popup ref="passwordPopup" type="center" :mask-click="false">
			<view class="password-confirm-modal">
				<view class="password-confirm-tips">请输入登录密码</view>
				<view class="password-confirm-ipt-box">
					<input type="password" class="password-confirm-ipt" value="" placeholder="请输入登录密码" placeholder-style="color:#C0C0C0;font-size:28rpx;" />
				</view>	
				<view class="password-confirm-bottom">
					<view @click="closePop()" >取消</view>
					<view @click="closePop()" >确定</view>	
				</view>	
			</view>
		</uni-popup>
		
		
		
	</view>
</template>

<script>
	/* function getRequestParams() {
			let url = location.href;
			let requestParams = {};
			if (url.indexOf('?') !== -1) {
				let str = url.substr(url.indexOf('?') + 1);
				let strs = str.split('&');
				for (let i = 0; i < strs.length; i++) {
					requestParams[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
				}
			}
			return requestParams;
	}
	let params = getRequestParams();
	let token = params['token'];
	let status_bar =  params['status_bar'];
	let source = 'wap'
	if(token!=undefined){
		uni.setStorage({
		    key: 'token',
		    data: token
		})
		source = 'app'
	}
	if(status_bar!=undefined){
		uni.setStorage({
		    key: 'status_bar',
		    data: status_bar
		})
	} */
	import store from "store"
	import {mapGetters,mapMutations,mapActions} from 'vuex'
	import { createGoldCharge } from "api/goldstormApi.js"
	import { payGoldChargeByAlipay,paysGoldChargesBySandwx,paysGoldChargesBySandwap,payGoldChargeByAdapayWxmini } from "api/paymentApi.js"
	import { getUser } from "api/userApi"
	
	export default {
		store,
		computed:{
			...mapGetters([
				'user',
				'statusBar',
				'isLogin'
			])
		},
		data:()=>({
			source:source,
			activityList:[1,2,3,4,5,6],
			invite_code:null,
			invest_amount:9.9,
			choiceType:'alipay',//alipay ，wxpay，unionpay,
			chargeNumList:[9.9,99,199,498,1200,2500,3800,6800,12800],
			tabIndex:0,
		}),
		methods:{
			...mapMutations([
				'setUser',
				'setStatusBar'
			]),
			copy(data){
				uni.setClipboardData({
				    data: data,
						showToast:false,
				    success: function () {
							uni.showToast({
								icon:'none',
								title:'复制成功'
							}) 
				    }
				})
				
				
				// const textarea = document.createElement('textarea')
				// textarea.value = data
				// textarea.readOnly = true
				// document.body.appendChild(textarea)
				// textarea.select()
				// textarea.setSelectionRange(0, data.length)
				// document.execCommand('copy')
				// textarea.remove()
				// uni.showToast({
				// 	icon:'none',
				// 	title:'复制成功',
				// 	duration:800
				// }) 
				
			},
			tabMth(index,num){
				this.tabIndex = index;
				this.invest_amount = num;
			},
			back(){
				if(this.source == 'wap'){
					var pages= getCurrentPages()
					if(pages.length==1){
						uni.redirectTo({ url: '/pages/activity/activity' })
					}else{
						uni.navigateBack()
					}
				}else{
					// window.flutter_inappwebview.callHandler('back_to_app', '')
					backToApp.postMessage('back');
				}
			},
			async getUser(){
				let response =  await getUser()
				this.setUser(response)
			},
			clearMoneyNum(){
				this.withdraw_amount = ''
			},
			allMoneyNum(){
				this.withdraw_amount = this.user.balance;
			},
			closePop(){
				this.$refs.passwordPopup.close()
			},
			choiceMethods(type){
				this.choiceType = type
			},
			async investMoney(){
				
				// this.$refs.passwordPopup.open('center')
				let _this = this;
				
				if(this.invest_amount==''){
					uni.showModal({
						title:'提示',
						content:'请输入储值金额！',
						confirmColor:'#FF6011',
						confirmText:'我知道了',
						showCancel:false
					})
					return 
				}
				
				if(this.choiceType == 'alipay'){
					let parms = {
						amount:this.invest_amount
					}
					const purchase = await createGoldCharge(parms)
					
					if(!purchase.message){
						if(this.statusBar>0){
							let id = purchase.id;
							
							// window.flutter_inappwebview.callHandler('gold_charges_app', id)
							goldChargesApp.postMessage(id);
							
						}else{
							uni.navigateTo({url: '/packs/pages/download/download?from=1'})
							
							// const payload = await payGoldChargeByAlipay(purchase.id)
							// //将接口返回的Form表单显示到页面
							// document.querySelector('body').innerHTML = payload.result;
							// //调用submit 方法
							// document.forms[0].submit()
							// uni.reLaunch({
							// 	url:"/pages/activity/activity?from=invest"
							// })
						}
					}else{
						if(Object.values(purchase.errors)[0][0]=='请先绑定支付宝账号'){
							let _this = this
							uni.showModal({
								content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
								confirmText:'去绑定',
								success: function (res) {
									if (res.confirm) {
										if(_this.statusBar>0){
											// window.flutter_inappwebview.callHandler('bind_alipay_app')
											bindAlipayApp.postMessage('bindali');
										}else{
											uni.navigateTo({url: '/packs/pages/download/download?from=1'})
										}
									}
								}
							})
						}else if(Object.values(purchase.errors)[0][0]=='请输入交易密码'){
								
						}else if(Object.values(purchase.errors)[0][0]=='请先设置交易密码'){
							if(this.statusBar>0){
								setPayCodeByApp.postMessage('paycodeset');
							}else{
								uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
							}
						}else{
							uni.showModal({
								title:'提示',
								content:Object.values(purchase.errors)[0][0],
								confirmText:'知道了',
								confirmColor:'#FF6011',
								showCancel:false
							})
						}
					}
				}else if(this.choiceType == 'wxpay'){
					let parms = { amount:this.invest_amount }
					const purchase = await createGoldCharge(parms)
					
					if(!purchase.message){
							if(this.statusBar>0){
								// goldChargesApp.postMessage(id);
								goldChargesByAdapayWxApp.postMessage(purchase.id)
								// const payload = await payGoldChargeByAdapayWxmini(purchase.id)
								// if(!payload.message){
								// 	let jumpPayUrl = ''
								// 	if(this.isWeiXinLogin){
								// 		jumpPayUrl = payload.result.wx_h5_pay_url;
								// 	}else{
								// 		jumpPayUrl = payload.result.scheme_code;
								// 	}
								// 	window.location.href = jumpPayUrl;
								// }else{
								// 	if(Object.values(payload.errors)[0][0]=='请先绑定银行卡账号'){
								// 		uni.showModal({
								// 			content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
								// 			confirmText:'去绑定',
								// 			success: function (res) {
								// 				if (res.confirm) {
								// 					uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
								// 				}
								// 			}
								// 		})
								// 	}else if(Object.values(payload.errors)[0][0]=='请先绑定支付宝账号'){
								// 		let _this = this
								// 		uni.showModal({
								// 			content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
								// 			confirmText:'去绑定',
								// 			success: function (res) {
								// 				if (res.confirm) {
								// 					if(_this.statusBar>0){
								// 						// window.flutter_inappwebview.callHandler('bind_alipay_app')
								// 						bindAlipayApp.postMessage('bindali');
								// 					}else{
								// 						uni.navigateTo({url: '/packs/pages/download/download'})
								// 					}
								// 				}
								// 			}
								// 		})
								// 	}else if(Object.values(payload.errors)[0][0]=='请输入交易密码'){
											
								// 	}else if(Object.values(payload.errors)[0][0]=='请先设置交易密码'){
								// 		if(this.statusBar>0){
								// 			setPayCodeByApp.postMessage('paycodeset');
								// 		}else{
								// 			uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
								// 		}
								// 	}else{
								// 		uni.showModal({
								// 			title:'提示',
								// 			content:Object.values(payload.errors)[0][0],
								// 			confirmText:'知道了',
								// 			confirmColor:'#FF6011',
								// 			showCancel:false
								// 		})
								// 	}
								// }
							}else{
								const payload = await payGoldChargeByAdapayWxmini(purchase.id)
								
								if(!payload.message){
									let jumpPayUrl = ''
									if(this.isWeiXinLogin){
										jumpPayUrl = payload.result.wx_h5_pay_url;
									}else{
										jumpPayUrl = payload.result.scheme_code;
									}
									window.location.href = jumpPayUrl;
									uni.reLaunch({
										url:"/pages/activity/activity?from=invest"
									})
								}else{
									if(Object.values(payload.errors)[0][0]=='请先绑定银行卡账号'){
										uni.showModal({
											content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
											confirmText:'去绑定',
											success: function (res) {
												if (res.confirm) {
													uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
												}
											}
										})
									}else if(Object.values(payload.errors)[0][0]=='请先绑定支付宝账号'){
										let _this = this
										uni.showModal({
											content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
											confirmText:'去绑定',
											success: function (res) {
												if (res.confirm) {
													if(_this.statusBar>0){
														// window.flutter_inappwebview.callHandler('bind_alipay_app')
														bindAlipayApp.postMessage('bindali');
													}else{
														uni.navigateTo({url: '/packs/pages/download/download'})
													}
												}
											}
										})
									}else if(Object.values(payload.errors)[0][0]=='请输入交易密码'){
											
									}else if(Object.values(payload.errors)[0][0]=='请先设置交易密码'){
										if(this.statusBar>0){
											setPayCodeByApp.postMessage('paycodeset');
										}else{
											uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
										}
									}else{
										uni.showModal({
											title:'提示',
											content:Object.values(payload.errors)[0][0],
											confirmText:'知道了',
											confirmColor:'#FF6011',
											showCancel:false
										})
									}	
								}
							}
					}else{
						if(Object.values(purchase.errors)[0][0]=='请先绑定银行卡账号'){
							uni.showModal({
								content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
								confirmText:'去绑定',
								success: function (res) {
									if (res.confirm) {
										uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
									}
								}
							})
						}else if(Object.values(purchase.errors)[0][0]=='请先绑定支付宝账号'){
							let _this = this
							uni.showModal({
								content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
								confirmText:'去绑定',
								success: function (res) {
									if (res.confirm) {
										if(_this.statusBar>0){
											// window.flutter_inappwebview.callHandler('bind_alipay_app')
											bindAlipayApp.postMessage('bindali');
										}else{
											uni.navigateTo({url: '/packs/pages/download/download'})
										}
									}
								}
							})
						}else if(Object.values(purchase.errors)[0][0]=='请输入交易密码'){
								
						}else if(Object.values(purchase.errors)[0][0]=='请先设置交易密码'){
							if(this.statusBar>0){
								setPayCodeByApp.postMessage('paycodeset');
							}else{
								uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
							}
						}else{
							uni.showModal({
								title:'提示',
								content:Object.values(purchase.errors)[0][0],
								confirmText:'知道了',
								confirmColor:'#FF6011',
								showCancel:false
							})
						}
					}
					
					
					
					
					// if(!purchase.message){
					// 		if(this.statusBar>0){
					// 			let payload = await paysGoldChargesBySandwx(purchase.id)
					// 			if(!payload.message){
					// 				goldChargesBySandwxApp.postMessage(payload.result);
					// 			}else{
					// 				if(Object.values(payload.errors)[0][0]=='请先绑定银行卡账号'){
					// 					uni.showModal({
					// 						content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
					// 						confirmText:'去绑定',
					// 						success: function (res) {
					// 							if (res.confirm) {
					// 								uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
					// 							}
					// 						}
					// 					})
					// 				}else if(Object.values(payload.errors)[0][0]=='请先绑定支付宝账号'){
					// 					let _this = this
					// 					uni.showModal({
					// 						content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
					// 						confirmText:'去绑定',
					// 						success: function (res) {
					// 							if (res.confirm) {
					// 								if(_this.statusBar>0){
					// 									// window.flutter_inappwebview.callHandler('bind_alipay_app')
					// 									bindAlipayApp.postMessage('bindali');
					// 								}else{
					// 									uni.navigateTo({url: '/packs/pages/download/download'})
					// 								}
					// 							}
					// 						}
					// 					})
					// 				}else if(Object.values(payload.errors)[0][0]=='请输入交易密码'){
											
					// 				}else if(Object.values(payload.errors)[0][0]=='请先设置交易密码'){
					// 					if(this.statusBar>0){
					// 						setPayCodeByApp.postMessage('paycodeset');
					// 					}else{
					// 						uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
					// 					}
					// 				}else{
					// 					uni.showModal({
					// 						title:'提示',
					// 						content:Object.values(payload.errors)[0][0],
					// 						confirmText:'知道了',
					// 						confirmColor:'#FF6011',
					// 						showCancel:false
					// 					})
					// 				}
					// 			}
					// 		}else{
					// 			let payload = await paysGoldChargesBySandwx(purchase.id)
					// 			if(!payload.message){
					// 				window.location.href = payload.result;
					// 			}else{
					// 				if(Object.values(payload.errors)[0][0]=='请先绑定银行卡账号'){
					// 					uni.showModal({
					// 						content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
					// 						confirmText:'去绑定',
					// 						success: function (res) {
					// 							if (res.confirm) {
					// 								uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
					// 							}
					// 						}
					// 					})
					// 				}else if(Object.values(payload.errors)[0][0]=='请先绑定支付宝账号'){
					// 					let _this = this
					// 					uni.showModal({
					// 						content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
					// 						confirmText:'去绑定',
					// 						success: function (res) {
					// 							if (res.confirm) {
					// 								if(_this.statusBar>0){
					// 									// window.flutter_inappwebview.callHandler('bind_alipay_app')
					// 									bindAlipayApp.postMessage('bindali');
					// 								}else{
					// 									uni.navigateTo({url: '/packs/pages/download/download'})
					// 								}
					// 							}
					// 						}
					// 					})
					// 				}else if(Object.values(payload.errors)[0][0]=='请输入交易密码'){
											
					// 				}else if(Object.values(payload.errors)[0][0]=='请先设置交易密码'){
					// 					if(this.statusBar>0){
					// 						setPayCodeByApp.postMessage('paycodeset');
					// 					}else{
					// 						uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
					// 					}
					// 				}else{
					// 					uni.showModal({
					// 						title:'提示',
					// 						content:Object.values(payload.errors)[0][0],
					// 						confirmText:'知道了',
					// 						confirmColor:'#FF6011',
					// 						showCancel:false
					// 					})
					// 				}	
					// 			}
					// 		}
					// }else{
					// 	if(Object.values(purchase.errors)[0][0]=='请先绑定银行卡账号'){
					// 		uni.showModal({
					// 			content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
					// 			confirmText:'去绑定',
					// 			success: function (res) {
					// 				if (res.confirm) {
					// 					uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
					// 				}
					// 			}
					// 		})
					// 	}else if(Object.values(purchase.errors)[0][0]=='请先绑定支付宝账号'){
					// 		let _this = this
					// 		uni.showModal({
					// 			content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
					// 			confirmText:'去绑定',
					// 			success: function (res) {
					// 				if (res.confirm) {
					// 					if(_this.statusBar>0){
					// 						// window.flutter_inappwebview.callHandler('bind_alipay_app')
					// 						bindAlipayApp.postMessage('bindali');
					// 					}else{
					// 						uni.navigateTo({url: '/packs/pages/download/download'})
					// 					}
					// 				}
					// 			}
					// 		})
					// 	}else if(Object.values(purchase.errors)[0][0]=='请输入交易密码'){
								
					// 	}else if(Object.values(purchase.errors)[0][0]=='请先设置交易密码'){
					// 		if(this.statusBar>0){
					// 			setPayCodeByApp.postMessage('paycodeset');
					// 		}else{
					// 			uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
					// 		}
					// 	}else{
					// 		uni.showModal({
					// 			title:'提示',
					// 			content:Object.values(purchase.errors)[0][0],
					// 			confirmText:'知道了',
					// 			confirmColor:'#FF6011',
					// 			showCancel:false
					// 		})
					// 	}
					// }
					
					
					
					
				}else if(this.choiceType == 'unionpay'){
					let parms = { amount:this.invest_amount }
					const purchase = await createGoldCharge(parms)
					if(!purchase.message){
							let payload = await paysGoldChargesBySandwap(purchase.id)
							if(!payload.message){
								window.location.href = payload.result;
								//let res = JSON.parse(payload.result).body.credential;
								//uni.navigateTo({url: payload.result})
								/* console.log(res);
								document.querySelector('body').innerHTML = res;
								//调用submit 方法
								document.forms[0].submit()
								uni.reLaunch({
									url:"/pages/activity/activity?from=invest"
								}) */
							}else{
								if(Object.values(payload.errors)[0][0]=='请先绑定银行卡账号'){
									uni.showModal({
										content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
										confirmText:'去绑定',
										success: function (res) {
											if (res.confirm) {
												uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
											}
										}
									})
								}else if(Object.values(payload.errors)[0][0]=='请先绑定支付宝账号'){
									let _this = this
									uni.showModal({
										content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
										confirmText:'去绑定',
										success: function (res) {
											if (res.confirm) {
												if(_this.statusBar>0){
													// window.flutter_inappwebview.callHandler('bind_alipay_app')
													bindAlipayApp.postMessage('bindali');
												}else{
													uni.navigateTo({url: '/packs/pages/download/download'})
												}
											}
										}
									})
								}else if(Object.values(payload.errors)[0][0]=='请输入交易密码'){
										
								}else if(Object.values(payload.errors)[0][0]=='请先设置交易密码'){
									if(this.statusBar>0){
										setPayCodeByApp.postMessage('paycodeset');
									}else{
										uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
									}
								}else{
									uni.showModal({
										title:'提示',
										content:Object.values(payload.errors)[0][0],
										confirmText:'知道了',
										confirmColor:'#FF6011',
										showCancel:false
									})
								}	
							}
					}else{
						if(Object.values(purchase.errors)[0][0]=='请先绑定银行卡账号'){
							uni.showModal({
								content:'您还未绑定本人银行卡，绑定本人银行卡后可进行储值！',
								confirmText:'去绑定',
								success: function (res) {
									if (res.confirm) {
										uni.navigateTo({url: '/packs/pages/withdrawal/addBankCard'})
									}
								}
							})
						}else if(Object.values(purchase.errors)[0][0]=='请先绑定支付宝账号'){
							let _this = this
							uni.showModal({
								content:'您还未绑定支付宝账号，请使用App绑定支付宝后可储值！',
								confirmText:'去绑定',
								success: function (res) {
									if (res.confirm) {
										if(_this.statusBar>0){
											// window.flutter_inappwebview.callHandler('bind_alipay_app')
											bindAlipayApp.postMessage('bindali');
										}else{
											uni.navigateTo({url: '/packs/pages/download/download?from=1'})
										}
									}
								}
							})
						}else if(Object.values(purchase.errors)[0][0]=='请输入交易密码'){
								
						}else if(Object.values(purchase.errors)[0][0]=='请先设置交易密码'){
							if(this.statusBar>0){
								setPayCodeByApp.postMessage('paycodeset');
							}else{
								uni.navigateTo({url: '/packs/pages/userset/setpaycode'})
							}
						}else{
							uni.showModal({
								title:'提示',
								content:Object.values(purchase.errors)[0][0],
								confirmText:'知道了',
								confirmColor:'#FF6011',
								showCancel:false
							})
						}
					}
				}
			}
		},
		async onShow(){
			if(status_bar!=undefined){
				this.setStatusBar(status_bar)
			}
			if(await this.isLogin){
				await this.getUser()
			}
			
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background: #F6F6F6;
	}
	.status {
		width: 100%;
		position: fixed;
		top: 0;
		z-index: 99;
		background: #F6F6F6;
	}
	.navigation{
		width: 100%;
		height: 100rpx;
		background: #F6F6F6;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		left:0;
		top:0;
		z-index:99;
	}
	.navigation-position{
		width: 100%;
		height: 100rpx;
		background: rgba(0,0,0,0);
	}
	.back{
		display: block;
		width: 48rpx;
		height: 48rpx;
		position: absolute;
		top: 26rpx;
		left:32rpx;
	}
	.navigation-title{
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}
	.withdrawal-amount{
		width: 690rpx;
		height: 196rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		// margin:60rpx auto 0;
		margin:10rpx auto 0;
		position: relative;
	}
	.withdrawal-amount-title{
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		line-height: 32rpx;
		margin-left: 32rpx;
		padding-top: 32rpx;
	}
	.withdrawal-amount-ipt-box{
		display: flex;
		align-items: center;
		margin-top: 44rpx;
		>view:nth-child(1){
			font-size: 40rpx;
			font-weight: bold;
			color: #272727;
			line-height: 48rpx;
			margin:0 16rpx 0 32rpx;
		}
		>input{
			width: 414rpx;
			font-size: 32rpx;
			font-weight: 400;
			color: #666666;
		}
		.clear-input{
			display: block;
			width: 32rpx;
			height: 32rpx;
		}
	}
	.choice-charge-num-box{
		width: 690rpx;
		margin:30rpx auto 0;
	}
	.choice-charge-num-title{
		width: 680rpx;
		margin: 20rpx auto 0;
		font-size: 30rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #333333;
		line-height: 40rpx;
	}
	.choice-charge-num-list{
		width: 690rpx;
		margin: 25rpx auto 0;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		>view{
			width: 218rpx;
			height: 90rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			background: #EDEDED;
			margin-bottom: 20rpx;
			border-radius: 10rpx;
			>text:nth-child(1){
				font-size: 44rpx;
				height: 40rpx;
				line-height: 40rpx;
				font-weight: 400;
				color: #333333;
				display: flex;
			}
			>text:nth-child(2){
				font-size: 24rpx;
				font-weight: 400;
				color: #333333;
				margin-left: 5rpx;
				margin-top: 5rpx;
			}
		}
		.activeTab{
			border: 4rpx solid #FF9500;
			width: 211rpx;
			height: 82rpx;
			>text{
				color: #FF9500!important;
			}
		}
	}
	
	.invest-money-tips{
		width: 660rpx;
		padding: 0 15rpx;
		margin: 20rpx auto 0;
		font-size: 24rpx;
		line-height: 40rpx;
		color: #999999;
		letter-spacing: 2rpx;
		>text{
			color: #333333;
			font-weight: 500;
		}
	}
	.invest-money-btn{
		width: 560rpx;
		height: 84rpx;
		background: #FF9500;
		border-radius: 48rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #FFFFFF;
		// margin: 180rpx auto;
		// margin: 50rpx auto;
		margin: 120rpx auto;
		letter-spacing: 2rpx;
	}
	.password-confirm-modal{
		width: 620rpx;
		height: 280rpx;
		padding:20rpx 0 64rpx 0;
		background: #FFFFFF;
		border-radius: 16rpx;
	}
	.password-confirm-tips{
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
		line-height: 80rpx;
		text-align: center;
	}
	.password-confirm-ipt-box{
		width: 528rpx;
		height: 84rpx;
		background: #F6F6F6;
		border-radius:15rpx;
		display: flex;
		align-items: center;
		padding-left: 30rpx;
		margin:30rpx auto;
	}
	.password-confirm-ipt{
		width: 450rpx;
		font-size: 28rpx;
		color: #555555;
	}
	.password-confirm-bottom{
		width: 100%;
		height: 90rpx;
		display: flex;
		border-top: 1rpx solid #cccccc;
		position: absolute;
		left:0;
		bottom: 0;
		>view{
			width: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 30rpx;
			font-weight: 500;
		}
		>view:nth-child(1){
			color:#999999;
		}
		>view:nth-child(2){
			color:#FF6011;
			border-left: 1rpx solid #cccccc;
		}
	}
	.withdrawal-methods{
		width:690rpx;
		// height:316rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0,0,0,0.1);
		border-radius: 16rpx;
		margin:16rpx auto 0;
	}
	.withdrawal-methods-title{
		border-bottom: 1rpx solid #F0F0F0;
		height: 106rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #333330;
		line-height: 28rpx;
		text-shadow: 0rpx 4rpx 8rpx rgba(0, 0, 0, 0.1);
		padding-left: 32rpx;
		display: flex;
		align-items: center;
	}
	.choice-item{
		height: 102rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.choice-item-line{
		width: 602rpx;
		height: 1rpx;
		background: #F0F0F0;
		margin-left: 88rpx;
	}
	.wechat-methods{
		display: block;
		width:44rpx;
		height: 44rpx;
		border-radius: 50%;
		margin:0 16rpx 0 24rpx;
	}
	.choice-item-left{
		display: flex;
		align-items: center;
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
		line-height: 24rpx;
		text-shadow: 0rpx 4rpx 8rpx rgba(0, 0, 0, 0.1);
	}
	.choice-radio{
		margin-right: 24rpx;
		width: 48rpx;
		height: 48rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		>view{
			width:28rpx;
			height: 28rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0,0,0,0.1);
			border: 2rpx solid #CECFD0;
			border-radius: 50%;
		}
	}
	.choiced{
		display: block;
		width: 39rpx;
		height:39rpx;
		border-radius: 50%;
	}
	.charge-tips-box{
		width: 640rpx;
		margin: 20rpx auto;
		border-radius: 15rpx;
		padding:20rpx 25rpx 20rpx 25rpx;
		background: #FFFFFF;
		.charge-tips-title{
			font-size: 28rpx;
			line-height: 50rpx;
			color: #333333;
			color: #1877FF;
			margin-bottom: 24rpx;
		}
	}
	.charge-tips-item{
		display: flex;
		align-items: center;
		margin-bottom: 15rpx;
		.charge-tips-text-box{
			font-size: 28rpx;
			color: #333333;
			display: flex;
			>text:nth-child(1){
				font-weight: 500;
			}
			>text:nth-child(2){
				width: 340rpx;
				color: #666666;
			}
			>text:nth-child(2).charge-tips-item-text{
				width: auto;
			}
		}
		.charge-tips-text-remarks{
			font-size: 28rpx;
			color: #333333;
			>text:nth-child(1){
				font-weight: 500;
			}
			>text:nth-child(2){
				color: #666666;
			}
		}
		.copy-btn{
			font-size: 28rpx;
			color: #333333;
			display: flex;
			align-items: center;
			margin-left: 15rpx;
			>view{
				margin:0 10rpx 0 15rpx;
			}
			>image{
				display: block;
				width: 30rpx;
				height: 30rpx;
			}
		}
	}
	.charge-tips-important{
			font-size: 28rpx;
			color: #1877FF;
			margin-top: 20rpx;
	}
</style>